/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EntityBeans;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author DROWNE
 */
@Entity
@Table(name = "gamesession")
@NamedQueries({
    @NamedQuery(name = "Gamesession.findAll", query = "SELECT g FROM Gamesession g"),
    @NamedQuery(name = "Gamesession.findByIdgamesession", query = "SELECT g FROM Gamesession g WHERE g.idgamesession = :idgamesession"),
    @NamedQuery(name = "Gamesession.findByLatitude", query = "SELECT g FROM Gamesession g WHERE g.latitude = :latitude"),
    @NamedQuery(name = "Gamesession.findByLongitude", query = "SELECT g FROM Gamesession g WHERE g.longitude = :longitude")})
public class Gamesession implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idgamesession")
    private Integer idgamesession;
    @Column(name = "latitude")
    private Integer latitude;
    @Column(name = "longitude")
    private Integer longitude;
    @JoinColumn(name = "user_username", referencedColumnName = "username")
    @OneToOne(optional = false)
    private User user;
    @JoinColumn(name = "team_idteam", referencedColumnName = "idteam")
    @OneToOne(optional = false)
    private Team team;
    @JoinColumn(name = "game_idgame", referencedColumnName = "idgame")
    @OneToOne(optional = false)
    private Game game;

    public Gamesession() {
    }

    public Gamesession(Integer idgamesession) {
        this.idgamesession = idgamesession;
    }

    public Integer getIdgamesession() {
        return idgamesession;
    }

    public void setIdgamesession(Integer idgamesession) {
        this.idgamesession = idgamesession;
    }

    public Integer getLatitude() {
        return latitude;
    }

    public void setLatitude(Integer latitude) {
        this.latitude = latitude;
    }

    public Integer getLongitude() {
        return longitude;
    }

    public void setLongitude(Integer longitude) {
        this.longitude = longitude;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Team getTeam() {
        return team;
    }

    public void setTeam(Team team) {
        this.team = team;
    }

    public Game getGame() {
        return game;
    }

    public void setGame(Game game) {
        this.game = game;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idgamesession != null ? idgamesession.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Gamesession)) {
            return false;
        }
        Gamesession other = (Gamesession) object;
        if ((this.idgamesession == null && other.idgamesession != null) || (this.idgamesession != null && !this.idgamesession.equals(other.idgamesession))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EntityBeans.Gamesession[idgamesession=" + idgamesession + "]";
    }

}
